﻿using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using KittyDru.Helpers;

namespace KittyDru
{
    class Character
    {
        #region Basic Variables
        private static LocalPlayer Me { get { return Styx.StyxWoW.Me; } }
        private static WoWUnit MyTarget { get { return Me.GotTarget ? Me.CurrentTarget : null; } }

        #endregion

        #region Character Data Variables & Properties
        public static Dictionary<string, bool> Glyphs = new Dictionary<string, bool>() {
            {Spells.Shred, false}
        };

        public static Dictionary<string, bool> DotsTF = new Dictionary<string, bool>() {
            {Spells.Rake, false},
            {Spells.Rip, false},
            {Spells.Thrash, false}
        };

        public static float EnergyRegen { get; set; }
        public static void getEnergyRegen()
        {
            EnergyRegen = Lua.GetReturnVal<float>("return GetPowerRegen()", 1);
        }

        public static void getGlyphs()
        {
            Glyphs[Spells.Shred] = TalentManager.HasGlyph("Shred");
            Utilities.log("Got a Glyphs: {0}", TalentManager.DumpGlyphs());

            if (Glyphs[Spells.Shred]) Utilities.log("Got a Shread Glyph!");
        }

        public static bool HaveMoreEnergy(string Spell, string CallSpell)
        {
            return (Me.CurrentEnergy - Spells.EnergyCost[Spell] - Spells.EnergyCost[CallSpell]) > 0;
        }
        public static bool DotHaveEnothTime(string Spell, string CallSpell)
        {
            double willRegenerated = (MyTarget.MyAuras()[Spell].TimeLeft.TotalSeconds) * Convert.ToDouble(EnergyRegen);
            double totalEnergyNow = willRegenerated + Me.CurrentEnergy;
            /*Utilities.log("{0} for: {1} sec. Total E after: {2}. Cost: {3}. Should cast: {4}. Have add: {5}",
                Spell,
                (MyTarget.Auras[Spell].TimeLeft.TotalSeconds - 1).ToString(),
                Math.Round(totalEnergyNow).ToString(), 
                ((Spells.EnergyCost[Spell] + Spells.EnergyCost[CallSpell])).ToString(),
                (Math.Round((double)Spells.EnergyCost[Spell] + Spells.EnergyCost[CallSpell]) < totalEnergyNow).ToString(),
                Math.Round(totalEnergyNow - (Spells.EnergyCost[Spell] + Spells.EnergyCost[CallSpell])).ToString()
                );*/
            return (Spells.EnergyCost[Spell] + Spells.EnergyCost[CallSpell]) < totalEnergyNow;
        }
        #endregion
    }
}
